// author:zandaoguang
import Vue from 'vue'
import Router from 'vue-router'
// in development env not use Lazy Loading,because Lazy Loading too many pages will cause webpack hot update too slow.so only in production use Lazy Loading
/* layout */
import Layout from '../views/layout/Layout'

const _import = require('./_import_' + process.env.NODE_ENV)
Vue.use(Router)

// 所有权限通用路由表
// 如首页和登陆页和一些不用权限的公用页面
export const constantRouterMap = [
  {path: '/login', component: _import('login/index'), hidden: true},
  {path: '/404', component: _import('404'), hidden: true},
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: '首页',
    hidden: true,
    children: [{
      path: 'dashboard', component: _import('dashboard/index')
    }]
  }
]

// 实例化vue的时候只挂载constantRouter
export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({y: 0}),
  routes: constantRouterMap
})


//异步挂载的路由
//动态需要根据权限加载的路由表 

//这里我们根据 vue-router官方推荐 的方法通过meta标签来标示改页面能访问的权限有哪些。如meta: { role: ['admin','super_editor'] }表示该页面只有admin和超级编辑才能有资格进入。
export const asyncRouterMap = [
  {
    path: '/staff',
    component: Layout,
    redirect: '/staff/staff',
    name: 'staff',
    meta: {title: '员工管理', icon: 'tree'},
    children: [
      {
        path: '/staff/staff', name: '员工管理', component: _import('staff/staff'), menu: 'staff',
        children:[
          {
            path: 'test', name: '人员管理', component: _import('staff/test'), meta: {title: '人员管理', icon: 'user'}, menu: 'staff',
          }
        ]
      },
      
    ]
  },
  {
    path: '/department',
    component: Layout,
    redirect: '/department/department',

    children: [
      {
        path: 'department',
        name: '部门管理',
        component: _import('department/department'),
        meta: {title: '部门管理', icon: 'example'},
        menu: 'department'
      },
    ]
  },
  {
    path: '/position',
    component: Layout,
    redirect: '/position/position',
    children: [
      {
        path: 'position',
        name: '岗位管理',
        component: _import('position/position'),
        meta: {title: '岗位管理', icon: 'example'},
        menu: 'position'
      },
    ]
  },
  {
    path: '/project',
    component: Layout,
    redirect: '/project/project',
    // name: 'project',
    // meta: {title: '项目管理', icon: 'tree'},
    children: [
      {
        path: 'project',
        name: '项目管理',
        component: _import('project/project'),
        meta: {title: '项目管理', icon: 'example'},
        menu: 'project'
      },
    ]
  },
  
  {
    path: '/echart',
    component: Layout,
    redirect: '/echart/line',

    children: [
      {
        path: 'line',
        name: '数据可视化',
        component: _import('echart/line'),
        meta: {title: '数据可视化', icon: 'example'},
        menu: 'line'
      },
    ]
  },

  {
    path: '/company',
    component: Layout,
    redirect: '/company/company',

    children: [
      {
        path: 'company',
        name: '公司管理',
        component: _import('company/company'),
        meta: {title: '公司管理', icon: 'tree'},
        menu: 'company'
      },
    ]
  },

  {
    path: '/designorder',
    component: Layout,
    redirect: '/designorder/designorder',

    children: [
      {
        path: 'designorder',
        name: '设计订单',
        component: _import('designorder/designorder'),
        meta: {title: '设计订单', icon: 'tree'},
        menu: 'designorder'
      },
    ]
  },

  {
    path: '/product',
    component: Layout,
    redirect: '/product/product',

    children: [
      {
        path: 'product',
        name: '生产订单',
        component: _import('product/product'),
        meta: {title: '生产订单', icon: 'tree'},
        menu: 'product'
      },
    ]
  },
  
  {
    path: '/committee',
    component: Layout,
    redirect: '/committee/committee',
    name: 'committee',
    meta: {title: '委员会', icon: 'tree'},
    children: [
      {
        path: 'committee',
        name: '委员会',
        component: _import('committee/committee_member'),
        meta: {title: '委员会', icon: 'example'},
        menu: 'committee'
      },
    ]
  },
  {
    path: '/purchase',
    component: Layout,
    redirect: '/purchase/purchase',
    name: 'purchase',
    meta: {title: '采购订单', icon: 'tree'},
    children: [
      {
        path: 'purchase', name: '采购订单', component: _import('purchase/purchase'), meta: {title: '采购订单', icon: 'user'}, menu: 'purchase',
      },      
    ]
  },
  {
    path: '/system',
    component: Layout,
    redirect: '/system/article',

    children: [
      {
        path: 'article',
        name: '文章管理',
        component: _import('article/article'),
        meta: {title: '文章管理', icon: 'example'},
        menu: 'article'
      },
    ]
  },
  

  {
    path: '/order',
    component: Layout,
    redirect: '/order/order',
    name: 'order',
    meta: {title: '订单管理', icon: 'tree'},
    children: [
      {
        path: '/order/order', name: '订单管理', component: _import('order/order'), menu: 'order',
        children:[
          {
            path: 'RNA_oligo', name: 'RNA_oligo管理', component: _import('order/RNA_oligo'), meta: {title: 'RNA_oligo管理', icon: 'user'}, menu: 'order',
          },
          {
            path: 'kit_probe', name: 'kit_probe管理', component: _import('order/kit_probe'), meta: {title: 'kit_probe管理', icon: 'user'}, menu: 'order',
<<<<<<< HEAD
=======
          },
          {
            path: 'DNAProbe', name: 'DNAProbe管理', component: _import('order/DNAProbe'), meta: {title: 'DNAProbe管理', icon: 'user'}, menu: 'order',
          },
          {
            path: 'Carrier', name: '载体管理', component: _import('order/Carrier'), meta: {title: '载体管理', icon: 'user'}, menu: 'order',
          },
          {
            path: 'FISH_Kit', name: 'FISH_Kit管理', component: _import('order/FISH_Kit'), meta: {title: 'FISH_Kit管理', icon: 'user'}, menu: 'order',
          },
          {
            path: 'Virus', name: '病毒管理', component: _import('order/Virus'), meta: {title: '病毒管理', icon: 'user'}, menu: 'order',
          },
          {
            path: 'Whole_gene', name: '全基因管理', component: _import('order/Whole_gene'), meta: {title: '全基因管理', icon: 'user'}, menu: 'order',
>>>>>>> develop
          }
        ]
      }
    ]
  },
  {
    path: '/warehouseEntry',
    component: Layout,
    redirect: '/warehouseEntry/warehouseEntry',

    children: [
      {
        path: 'warehouseEntry',
        name: '入库管理',
        component: _import('warehouseEntry/warehouseEntry'),
        meta: {title: '入库管理', icon: 'example'},
        menu: 'warehouse_entry'
      },
    ]
  },

<<<<<<< HEAD
=======
  {
    path: '/warehouseOut',
    component: Layout,
    redirect: '/warehouse/whout',

    children: [
      {
        path: 'warehouseOut',
        name: '出库管理',
        component: _import('warehouse/whout'),
        meta: {title: '出库管理', icon: 'example'},
        menu: 'warehouse_out'
      },
    ]
  },

>>>>>>> develop
  // {
  //   path: '/system',
  //   component: Layout,
  //   redirect: '/system/article',

  //   children: [
  //     {
  //       path: 'article',
  //       name: '文章管理',
  //       component: _import('article/article'),
  //       meta: {title: '文章管理', icon: 'example'},
  //       menu: 'article'
  //     },
  //   ]
  // },
  // {
  //   path: '/pay',
  //   component: Layout,
  //   redirect: '/pay/alipay',

  //   children: [
  //     {
  //       path: 'alipay',
  //       name: '支付功能',
  //       component: _import('pay/alipay'),
  //       meta: {title: '支付功能', icon: 'example'},
  //       menu: 'alipay'
  //     },
  //   ]
  // },
  {
    path: '/user',
    component: Layout,
    redirect: '/user/',

    children: [
      {
        path: 'role',
        name: '权限管理',
        component: _import('user/role'),
        meta: {title: '权限管理', icon: 'password'},
        menu: 'role'
      },
    ]
  },
  // {
  //   path: '/develop',
  //   component: Layout,
  //   redirect: '/develop/develop',
  //   name: 'develop',
  //   meta: {title: '辅助开发', icon: 'tree'},
  //   children: [
  //     {
  //       path: 'develop', name: '采购订单', component: _import('develop/dev_form'), meta: {title: '辅助开发', icon: 'user'}, menu: 'develop',
  //     },      
  //   ]
  // },
  {path: '*', redirect: '/404', hidden: true}
]
